gpui: Small tab group performance improvements#41885
Merged
Merged
Conversation
We unnecessarily looked for the group id and then looked it up in the hashmap, when we could iterate through the group right away
Collaborator
|
Thanks for the PR @tidely, we'll check it out. |
tidely
commented
Nov 4, 2025
| @@ -341,12 +343,9 @@ impl SystemWindowTabController { | |||
|
|
|||
| /// Get all tabs in the same window. | |||
| pub fn tabs(&self, id: WindowId) -> Option<&Vec<SystemWindowTab>> { | |||
Contributor
Author
There was a problem hiding this comment.
This has become such a small helper that I'd consider removing it entirely. It's only called a few times and the majority of the time, we use .position() right after to find the index of tab with the right WindowId. Which could be done right away instead of using the helper first, thus removing an iteration through the values.
Contributor
|
Thank you for the PR! |
rtfeldman
pushed a commit
that referenced
this pull request
Jan 5, 2026
Closes #ISSUE Removes a few eager container clones and iterations. Added a todo to `get_prev_tab_group_window` and `get_next_tab_group_window`. They seem to use `HashMap::keys()` for choosing the previous tab group, however `.keys()` returns an arbitrary order, so I'm not sure if previous actually means anything here. Conrad seems to have worked on this part previously, maybe he has some insights. That can possibly be a follow-up PR, but I'd be willing to work on it here as well since the other changes are so simple. Release Notes: - N/A
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #ISSUE
Removes a few eager container clones and iterations.
Added a todo to
get_prev_tab_group_windowandget_next_tab_group_window. They seem to useHashMap::keys()for choosing the previous tab group, however.keys()returns an arbitrary order, so I'm not sure if previous actually means anything here. Conrad seems to have worked on this part previously, maybe he has some insights. That can possibly be a follow-up PR, but I'd be willing to work on it here as well since the other changes are so simple.Release Notes: